Don't crash if the path does not point to a row in the model. (#300909,
authorMatthias Clasen <mclasen@redhat.com>
Fri, 29 Apr 2005 14:56:37 +0000 (14:56 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 29 Apr 2005 14:56:37 +0000 (14:56 +0000)
2005-04-29  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkiconview.c (gtk_icon_view_select_path): Don't crash
if the path does not point to a row in the model.  (#300909,
Mathias Hasselmann)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkiconview.c

index 95ca30919f8c02f39cc1f56ba8408d8deffdf4bb..931f0cbe27024c4f6b580917489deeb6445fd106 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-04-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkiconview.c (gtk_icon_view_select_path): Don't crash
+       if the path does not point to a row in the model.  (#300909,
+       Mathias Hasselmann)
+
        * tests/testtext.c: Add some more attribute tests.
 
        * gtk/gtktexttag.c (gtk_text_tag_class_init): Correct the documentation
index 95ca30919f8c02f39cc1f56ba8408d8deffdf4bb..931f0cbe27024c4f6b580917489deeb6445fd106 100644 (file)
@@ -1,5 +1,9 @@
 2005-04-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkiconview.c (gtk_icon_view_select_path): Don't crash
+       if the path does not point to a row in the model.  (#300909,
+       Mathias Hasselmann)
+
        * tests/testtext.c: Add some more attribute tests.
 
        * gtk/gtktexttag.c (gtk_text_tag_class_init): Correct the documentation
index 95ca30919f8c02f39cc1f56ba8408d8deffdf4bb..931f0cbe27024c4f6b580917489deeb6445fd106 100644 (file)
@@ -1,5 +1,9 @@
 2005-04-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkiconview.c (gtk_icon_view_select_path): Don't crash
+       if the path does not point to a row in the model.  (#300909,
+       Mathias Hasselmann)
+
        * tests/testtext.c: Add some more attribute tests.
 
        * gtk/gtktexttag.c (gtk_text_tag_class_init): Correct the documentation
index 56369f5e19dc936b19d6d173d6162a57042db508..d692aa5353301b29259cd61c0818bdbb81450793 100644 (file)
@@ -3480,19 +3480,17 @@ void
 gtk_icon_view_select_path (GtkIconView *icon_view,
                           GtkTreePath *path)
 {
-  GtkIconViewItem *item;
-  
+  GList *l;
+
   g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
   g_return_if_fail (icon_view->priv->model != NULL);
   g_return_if_fail (path != NULL);
 
-  item = g_list_nth (icon_view->priv->items,
-                    gtk_tree_path_get_indices(path)[0])->data;
+  l = g_list_nth (icon_view->priv->items,
+                 gtk_tree_path_get_indices(path)[0]);
 
-  if (!item)
-    return;
-  
-  gtk_icon_view_select_item (icon_view, item);
+  if (l != NULL)
+    gtk_icon_view_select_item (icon_view, l->data);
 }
 
 /**